/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};

/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {

/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId])
/******/ 			return installedModules[moduleId].exports;

/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			exports: {},
/******/ 			id: moduleId,
/******/ 			loaded: false
/******/ 		};

/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

/******/ 		// Flag the module as loaded
/******/ 		module.loaded = true;

/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}


/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;

/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;

/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";

/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ({

/***/ 0:
/***/ function(module, exports, __webpack_require__) {

	/**
	 * Created by Administrator on 2017/3/9.
	 */
	var Pagination = __webpack_require__(26);

	var Root = React.createClass({displayName: "Root",
	    getInitialState: function(){
	        return {
	            pageVal: PageDM.pagination.value
	        }
	    },
	    pageClick:function (v) {
	        PageDM.pagination.setValue({curPage:v});
	        PageDM.pagination.onClick(v);
	    },
	    componentDidMount: function(){
	        UEventHub.emit("pageLoad","hello world!");
	        var _this = this;

	    },
	    render:function(){
	        var _this = this;
	        return(
	            React.createElement("div", null, 
	                React.createElement(Pagination, {pageVal: _this.state.pageVal, onClick: this.pageClick})
	            )
	        )
	    }
	});
	ReactDOM.render(React.createElement(Root, null), document.getElementById('main'));

/***/ },

/***/ 26:
/***/ function(module, exports) {

	/**
	 * Created by Administrator on 2017/4/11.
	 */
	var Pagination = React.createClass({displayName: "Pagination",
	    getDefaultProps: function () {
	      return {
	          pageVal:{}
	      }
	    },
	    getInitialState: function () {
	        return{
	            curPage:this.props.pageVal.curPage
	        }
	    },
	    onClick: function (curPage) {
	        this.setState({curPage:curPage});
	        this.props.onClick && this.props.onClick(curPage);
	    },
	    render: function(){
	        var _this = this;
	        var pageVal = _this.props.pageVal;
	        var curPage = _this.state.curPage;
	        var div = [];
	        if(pageVal.totalPage > 1 && pageVal.totalPage <= 7){
	            for(var i = 0; i <= pageVal.totalPage+1; i++){
	                var a = document.createElement("a");
	                a.setAttribute("href","javascript:;");
	                if(i==0){
	                    a.innerHTML = "&lt;";
	                    if(curPage > 1){
	                        a.onclick = function(){
	                            _this.onClick(curPage-1);
	                        };
	                    }else{
	                        a.className = "pagination-disabled";
	                    }
	                }else if(i == pageVal.totalPage+1){
	                    a.innerHTML = "&gt;";
	                    if(curPage < pageVal.totalPage){
	                        a.onclick = function(){
	                            _this.onClick(curPage+1);
	                        };
	                    }else{
	                        a.className = "pagination-disabled";
	                    }
	                }else{
	                    a.innerHTML = i;
	                    (function(ii){
	                        a.onclick = function(){
	                            _this.onClick(ii);
	                        };
	                    })(i);
	                    if(i == curPage){
	                        a.className = "current";
	                    }
	                }
	                div.push(a);
	            }
	        }else if(pageVal.totalPage > 7){
	            var dotIndex = 0;
	            if(curPage<=5 || (pageVal.totalPage - curPage) <= 4 ){
	                if((curPage - 1) < (pageVal.totalPage - curPage)){
	                    dotIndex = 6;
	                }else{
	                    dotIndex = 2;
	                }
	            }
	            for(var i = 0; i < 9; i++){
	                var a = document.createElement("a");
	                a.setAttribute("href","javascript:;");
	                if(i==0){
	                    a.innerHTML = "&lt;";
	                    if(curPage > 1){
	                        a.onclick = function(){
	                            _this.onClick(curPage-1);
	                        };
	                    }else{
	                        a.className = "pagination-disabled";
	                    }
	                }else if(i == 8){
	                    a.innerHTML = "&gt;";
	                    if(curPage < pageVal.totalPage){
	                        a.onclick = function(){
	                            _this.onClick(curPage+1);
	                        };
	                    }else{
	                        a.className = "pagination-disabled";
	                    }
	                }else{
	                    if(dotIndex == 0){
	                        if(i == 2 || i == 6){
	                            if(i == 2){
	                                a.onclick = function(){
	                                    _this.onClick(curPage-3);
	                                };
	                                a.className = "jump-prev";
	                                a.setAttribute("title","Previous 3 Pages");
	                            }else if(i == 6){
	                                a.onclick = function(){
	                                    _this.onClick(curPage+3);
	                                };
	                                a.className = "jump-next";
	                                a.setAttribute("title","Next 3 Pages");
	                            }
	                        }else{
	                            if(i == 1){
	                                a.innerHTML = 1;
	                                a.onclick = function(){
	                                    _this.onClick(1);
	                                };
	                            }else if(i == 7){
	                                a.innerHTML = pageVal.totalPage;
	                                a.onclick = function(){
	                                    _this.onClick(pageVal.totalPage);
	                                };
	                            }else if(i == 3){
	                                a.innerHTML = curPage-1;
	                                a.onclick = function(){
	                                    _this.onClick(curPage-1);
	                                };
	                            }else if(i == 4){
	                                a.innerHTML = curPage;
	                                a.onclick = function(){
	                                    _this.onClick(curPage);
	                                };
	                                a.className = "current";
	                            }else if(i == 5){
	                                a.innerHTML = curPage+1;
	                                a.onclick = function(){
	                                    _this.onClick(curPage+1);
	                                };
	                            }
	                        }
	                    }else if(dotIndex == 2){
	                        if(i == dotIndex){
	                            a.onclick = function(){
	                                _this.onClick(curPage-3);
	                            };
	                            a.className = "jump-prev";
	                            a.setAttribute("title","Previous 3 Pages");
	                        }else{
	                            if(i == 1){
	                                a.innerHTML = 1;
	                                a.onclick = function(){
	                                    _this.onClick(1);
	                                };
	                            }else{
	                                a.innerHTML = (pageVal.totalPage-(7-i));
	                                (function(i){
	                                    a.onclick = function(){
	                                        _this.onClick(pageVal.totalPage-(7-i));
	                                    };
	                                })(i);
	                            }
	                        }
	                        if((pageVal.totalPage-(7-i)) == curPage){
	                            a.className = "current";
	                        }
	                    }else if(dotIndex == 6){
	                        if(i == dotIndex){
	                            a.onclick = function(){
	                                _this.onClick(curPage+3);
	                            };
	                            a.className = "jump-next";
	                            a.setAttribute("title","Next 3 Pages");
	                        }else{
	                            if(i == 7){
	                                a.innerHTML = pageVal.totalPage;
	                                a.onclick = function(){
	                                    _this.onClick(pageVal.totalPage);
	                                };
	                            }else{
	                                a.innerHTML = i;
	                                (function(i){
	                                    a.onclick = function(){
	                                        _this.onClick(i);
	                                    };
	                                })(i);
	                            }
	                        }
	                        if(i == curPage){
	                            a.className = "current";
	                        }
	                    }
	                }
	                div.push(a);
	            }
	        }
	        return (
	            React.createElement("div", {className: "pagination"}, 
	                div
	            )
	        )
	    }
	});

	module.exports = Pagination;

/***/ }

/******/ });